package conservare.modelo.banco;

import java.io.Serializable;

import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.OneToOne;

@Embeddable
public class SequencialBoletoPK implements Serializable{

	private static final long serialVersionUID = 4454768667653895157L;
	
	@OneToOne
	@JoinColumns({
	    @JoinColumn(name="conta_id", referencedColumnName="conta_id", insertable=false, updatable=false),
	    @JoinColumn(name="num_carteira",  referencedColumnName="num_carteira",  insertable=false, updatable=false),
	    @JoinColumn(name="modalidade",  referencedColumnName="modalidade",  insertable=false, updatable=false)
	})  
	private CarteiraBoleto id;
	
	
	
	public SequencialBoletoPK(){}
	
	
	public SequencialBoletoPK(CarteiraBoleto carteira) {
		super();
		this.id = carteira;
	}


	public CarteiraBoleto getId() {
		return id;
	}


	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}


	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SequencialBoletoPK other = (SequencialBoletoPK) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}


	

}
